home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Library
/
RoseWare - Network Support Library.iso
/
apidev
/
batuti.arc
/
SETCWD.C
< prev
next >
Wrap
Text File
|
1990-01-10
|
884b
|
43 lines
/*
*
* setcwd -- sets the environment variable name in arg[1] to the current
* working directory
* Richard Connelly,(C) 1989,1990
*
*/
#include <stdio.h>
#include <conio.h>
#include <process.h>
#include <dos.h>
#include <dir.h>
#include <mem.h>
#include "mst_env.h"
#define buflen 256
void main(int argc, char *argv[])
{
/*
* Determine if the user is using the command correctly
*/
char buf[buflen];
if (argc == 1)
{
fprintf(stderr," usage:\n\t setcwd env-name \n");
exit(-1);
}
/*
* Set the cwd to an environment variable provided via argv
*/
/* set the environment var passed */
getcwd(buf,buflen);
if ( m_putenv(argv[1],buf))
fprintf(stderr,"Out of environment space\n");
exit(0); /* by argv & terminate successfully */
}